import type { RouteRecordRaw } from 'vue-router'

// 预加载所有医生视图组件
import DoctorLayout from '@/views/doctorViews/layouts/index.vue'
import DoctorOverview from '@/views/doctorViews/overview/index.vue'
import DoctorProfile from '@/views/doctorViews/profile/index.vue'
import DoctorSchedule from '@/views/doctorViews/schedule/index.vue'
import DoctorAnalysis from '@/views/doctorViews/analysis/index.vue'
import PatientList from '@/views/doctorViews/patient/list/index.vue'
import PatientDetail from '@/views/doctorViews/patient/list/components/list-detail/index.vue'
import RightContent from '@/views/doctorViews/patient/list/components/list-detail/components/components/RightContent.vue'
import RiskAssessment from '@/views/doctorViews/patient/list/components/list-detail/components/components/risk-assessment.vue'
import AiDiagnosis from '@/views/doctorViews/patient/list/components/list-detail/components/components/ai-diagnosis.vue'
import PrescriptionSuggestions from '@/views/doctorViews/patient/list/components/list-detail/components/components/prescription-suggestions.vue'
import PatientTrace from '@/views/doctorViews/patient/trace/index.vue'
import DoctorAppointment from '@/views/doctorViews/appointment/index.vue'
import Emergency from '@/views/doctorViews/remote/emergency/index.vue'
import Consultation from '@/views/doctorViews/consultation/index.vue'

const routes: RouteRecordRaw[] = [
  {
    path: '/doctor',
    component: DoctorLayout,
    redirect: '/doctor/overview',
    meta: {
      role: 'doctor',
      requiresAuth: true
    },
    children: [
      //概览
      {
        path: 'overview',
        component: DoctorOverview,
        meta: { requiresAuth: true }
      },
      //个人中心
      {
        path: 'profile',
        component: DoctorProfile,
        meta: { requiresAuth: true }
      },
      //日程
      {
        path: 'schedule',
        component: DoctorSchedule,
        meta: { requiresAuth: true }
      },
      //数据分析
      {
        path: 'analysis',
        component: DoctorAnalysis,
        meta: { requiresAuth: true }
      },
      //患者管理
      {
        path: 'patient-list',
        component: PatientList,
        meta: { requiresAuth: true }
      },
      {
        path: 'patient-detail/:id',
        component: PatientDetail,
        meta: { requiresAuth: true },
        redirect: to => `${to.path}/RightContent`,
        children: [
          {
            path: 'RightContent',
            component: RightContent,
            meta: { requiresAuth: true }
          },
          {
            path: 'risk-assessment',
            component: RiskAssessment,
            meta: { requiresAuth: true }
          },
          {
            path: 'ai-diagnosis',
            component: AiDiagnosis,
            meta: { requiresAuth: true }
          },
          {
            path: 'prescription-suggestions',
            component: PrescriptionSuggestions,
            meta: { requiresAuth: true }
          },
        ]
      },
      {
        path: 'patient-trace',
        component: PatientTrace,
        meta: { requiresAuth: true }
      },

      //预约服务
      {
        path: 'appointment',
        component: DoctorAppointment,
        meta: { requiresAuth: true }
      },
      //远程支持
      {
        path: 'emergency',
        component: Emergency,
        meta: { requiresAuth: true }
      },
      {
        path: 'consultation',
        component: Consultation,
        meta: { requiresAuth: true }
      },
    ]
  }
]

export default routes
